import Vue from "vue";
import Router from "vue-router";
import saleRouterList from './sale/sale';

Vue.use(Router);

export default new Router({
    routes: [
        {
            path: "/",
            name: "login",
            component: resolve => (require(["@/pages/login"], resolve)),
            // redirect: 'login'
        },
        {
            path: "/main",
            name: "main",
            component: resolve => (require(["@/pages/main"], resolve)),
            children: [
                {
                    path: '/workbord',
                    name: 'workbord',
                    meta: { zIndex: 1 },
                    component: resolve => (require(["@/pages/dashboard/workbord"], resolve)),
                },
                ...saleRouterList
            ]
        }
    ]
});

const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
}